import Mock from 'mockjs'
import {newList} from './mockData'
Mock.setup({
  timeout: 300, // 设置延迟响应，模拟向后端请求数据
});
// 获取 mock.Random 对象
const Random = Mock.Random;
//创建信息列表接口
Mock.mock('/mockApi/getNews', 'post', (option) => {
  let body = JSON.parse(option.body);
  if(body.dataType){
    return newList.filter(item=>item.type===body.dataType)
  }else{
    return newList
  }
})
//获取用户菜单权限
Mock.mock('/mockApi/getUserMenu','post',(opation)=>{
  let body = JSON.parse(opation.body);
  if(body.name==='info'){
    return ['info']
  }else{
    return ['info','user']
  }
})